package com.hu.bookstore.controller;

import com.hu.bookstore.service.bookService;
import com.hu.bookstorecommon.entity.DataPage;
import com.hu.bookstorecommon.entity.book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class bookController {
   @Autowired
   private bookService bookService;


  @GetMapping("/book")
    public DataPage<book> dataPage(Integer pageNum, Integer pageSize, Integer cid, String authorName, String bookName){
      Integer page=pageNum==null?1:pageNum;

      Integer cid1=cid==null?0:cid;
      String authorname=authorName==null?"":authorName;
      String bookname=bookName==null?"":bookName;


      return bookService.getAllBooks(page, pageSize, cid1, authorname, bookname);
  }


}
